package com.wu.ssm.tomcat;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Created by wzf on 2018/11/11/011.
 */
public class MyServer {

    private static int count = 0;

    public static void main(String[] args) {

        start();
    }


    private static void start() {
        try {
            ServerSocket serverSocket = new ServerSocket(8080);
            System.out.println("Tomcat 服务已启动，地址：localhost ,端口：" + 8080);
            //持续监听
            do {
                Socket socket = serverSocket.accept();
                System.out.println(socket);
                //处理任务
                Thread thread = new SocketProcess(socket);
                thread.start();
            } while (true);

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
